import axios from 'axios'
/* 获取综合楼租赁列表 /rentserver/project/building/page?current=1&size=10 */
export const addCar = data => {
  return axios({
    method: 'post',
    url: '/webcar/car/save', //rentserver/project/detail/3902
    data
  })
}
export const ExportFile = (url, obj) => {
  axios({
    url: url,
    method: 'get',
    params: obj,
    responseType: 'blob',
    ContentType: 'multipart/form-data'
  }).then(response => {
    if (!response) {
      return
    }
    console.log(response);
    let link = document.createElement('a')
    link.href = window.URL.createObjectURL(new Blob([response.data]))
    link.target = '_blank'
    let filename = response.headers['content-disposition']
    link.download = decodeURI(filename)
    document.body.appendChild(link)
    link.click()
    document.body.removeChild(link)
    // console.log(response);
    // let link = document.createElement('a')
    // link.href = window.URL.createObjectURL(new Blob([response.data]))
    // link.target = '_blank'
    // let filename = response.headers['content-disposition']
    // link.download = decodeURI(filename)
    // document.body.appendChild(link)
    // link.click()
    // document.body.removeChild(link)
  })
}
/*确认集体进场*/
export const ConfirmApproach = data => {
  return axios({
    method: 'post',
    url: '/webcar/car/batchinCar', //rentserver/project/detail/3902
    data
  })
}
/*确认单个入场*/
export const ConfirmApproachOne = (id, params) => {
  return axios({
    method: 'get',
    url: `/webcar/car/inCar/${id}`, //rentserver/project/detail/3902
    params
  })
}
/*确认集体出场*/
export const outAllCar = data => {
  return axios({
    method: 'post',
    url: `/webcar/car/batchoutCar`, //rentserver/project/detail/3902
    data
  })
}
/*确认单个出场*/
export const outCar = (id, params) => {
  return axios({
    method: 'get',
    url: `/webcar/car/outCar/${id}`, //rentserver/project/detail/3902
    params
  })
}
/*获取在场车辆数量*/
export const getincarNum = params => {
  return axios({
    method: 'get',
    url: `/webcar/car/line`, //rentserver/project/detail/3902
    params
  })
}
/*导入文件*/
export const importCar = params => {
  return axios({
    method: 'post',
    url: `/webcar/car/importCar`, //rentserver/project/detail/3902
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: params
  })
}

// export const HttpRequest(fileobj) {
//   let param = new FormData();
//   // 上传文件对象 名称file与后台控制器参数要一致
//   param.append('file', fileobj.file);
//   return axios({
//     method: 'post',
//     // 上传地址
//     url: '/goods-service/goods/sku/file',
//     // 定义上传头
//     headers: {
//       'Content-Type': 'multipart/form-data'
//     },
//     data: param
//   });
// }